/*
 * GUIApp.java
 */

package gui;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
import Toepen.LoungeFacade.ILoungeFacade;
import Toepen.LoungeFacade.LoungeFacadeFactory;
import Toepen.LoungeFacade.LoungeSpel;
import Toepen.SpelFacade.ISpelFacade;
import javax.swing.JOptionPane;

/**
 * Start de LoungeGUI op. Dit is de eerste klasse die een gebruiker opstart
 */
public class GUIApp extends SingleFrameApplication {

    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        ISpelFacade spelFacade = null;
        LoungeSpel spel = null;

        try
        {
            ILoungeFacade loungeFacade=LoungeFacadeFactory.Create();

             // TODO: Load lounge screen in plaats van spelscherm
            GUILounge loungeView = new GUILounge(this);
            show(loungeView);

            loungeView.setLounge(loungeFacade);
        }
        catch (Exception e)
        {
	        JOptionPane.showMessageDialog(null, e.getMessage(), "FOUT", JOptionPane.INFORMATION_MESSAGE);
        }
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     * @param root
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of GUIApp
     */
    public static GUIApp getApplication() {
        return Application.getInstance(GUIApp.class);
    }

    /**
     * Main method launching the application.
     * @param args
     */
    public static void main(String[] args) {
        launch(GUIApp.class, args);
    }

//    @Action public void quit() {
//        String s = "test";
//    }
}
